<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::group([
    'prefix' => 'notify/landingc',
    'middleware' => 'api',
    'namespace' => 'Api\LandingC'
], function() {
    //注册子商户号回调
    Route::post('register_notify', 'LandingCNotifyController@subMechantRegisterNotify');
    //子商户开卡成功返回url
    Route::get('open_card_return', 'LandingCNotifyController@subMechantOpenCardReturn');
    //子商户开卡回调
    Route::post('open_card_notify', 'LandingCNotifyController@subMechantOpenCardNotify');
    //消费回调
    Route::post('consume_notify', 'LandingCNotifyController@consumeNotify');
    //还款回调
    Route::post('repayment_notify', 'LandingCNotifyController@repaymentNotify');
    //提现回调
    Route::post('withdraw_notify', 'LandingCNotifyController@withdrawNotify');
    //收银成功返回url
    Route::get('quick_money_return', 'LandingCNotifyController@quickMoneyReturn');
    //收银回调
    Route::post('quick_money_notify', 'LandingCNotifyController@quickMoneyNotify');
});

Route::group([
    'prefix' => 'notify/landinge',
    'middleware' => 'api',
    'namespace' => 'Api\LandingE'
], function() {
    //消费回调
    Route::post('consume_notify', 'LandingENotifyController@consumeNotify');
    //还款回调
    Route::post('repayment_notify', 'LandingENotifyController@repaymentNotify');
    //提现回调
    Route::post('withdraw_notify', 'LandingENotifyController@withdrawNotify');
    //收银成功返回url
    Route::get('quick_money_return', 'LandingENotifyController@quickMoneyReturn');
    //收银回调
    Route::post('quick_money_notify', 'LandingENotifyController@quickMoneyNotify');
});

Route::group([
    'prefix' => 'notify/quick_pay_f/',
    'middleware' => 'api',
    'namespace' => 'Api\Notify'
], function() {
    //交易回调
    Route::post('trade', 'QuickPayFNotifyController@trade');
    //页面成功返回url
    Route::get('quick_money_return', 'QuickPayFNotifyController@quickMoneyReturn');
});

Route::group([
    'prefix' => 'notify/quick_pay_l/',
    'middleware' => 'api',
    'namespace' => 'Api\Notify'
], function() {
    //交易回调
    Route::post('trade', 'QuickPayLNotifyController@trade');
    //页面成功返回url
    Route::get('quick_money_return', 'QuickPayFNotifyController@quickMoneyReturn');
});

Route::group([
    'prefix' => 'notify/landing_pay_c/',
    'middleware' => 'api',
    'namespace' => 'Api\Notify'
], function() {
    Route::post('return', 'LandingPayCNotifyController@subMechantOpenCardReturn');
    //子商户绑卡回调
    Route::post('bind_card', 'LandingPayCNotifyController@bindCard');
    //交易回调
    Route::post('trade', 'LandingPayCNotifyController@trade');
    //提现回调
    Route::post('withdraw', 'LandingPayCNotifyController@withdraw');
    //自动处理提现回调
    Route::post('withdraw_handle', 'LandingPayCNotifyController@withdrawHandle');
});

Route::group([
    'prefix' => 'notify/large_pay_x/',
    'middleware' => 'api',
    'namespace' => 'Api\Notify'
], function() {
    //交易回调
    Route::post('trade', 'LargePayXNotifyController@trade');
    //提现回调
    Route::post('withdraw', 'LargePayXNotifyController@withdraw');
    //自动处理提现回调
    Route::post('withdraw_handle', 'LargePayXNotifyController@withdrawHandle');
});

Route::group([
    'prefix' => 'notify/payment/',
    'middleware' => 'api',
    'namespace' => 'Api\Notify'
], function() {
    //交易回调
    Route::post('trade', 'PaymentNotifyController@trade');
});

Route::group([
    'prefix' => 'repayment/jobs',
    'middleware' => 'api',
    'namespace' => 'Api\Jobs'
], function() {
    //还款计划消费任务
    Route::get('repayment_plan_consume', 'RepaymentPlanJobsController@consume');
    //还款计划还款任务
    Route::get('repayment_plan_repayment', 'RepaymentPlanJobsController@repayment');
    //还款计划自动提现任务
    Route::get('repayment_plan_auto_withdraw', 'RepaymentPlanJobsController@repaymentPlanAutoWithdraw');

    Route::post('repayment_plan_action_withdraw', 'RepaymentPlanJobsController@repaymentPlanActionWithdraw');
});

Route::group([
    'prefix' => 'trade',
    'middleware' => 'api',
    'namespace' => 'Api\Jobs'
], function() {
    //账户余额提现查询
    Route::get('personal_account_withdraw_query', 'TradeQueryJobsController@personalAccountWithdrawQuery');
    //收银提现查询
    Route::get('collect_money_withdraw_query', 'TradeQueryJobsController@collectMoneyWithdrawQuery');
});

Route::group([
    'prefix' => 'notify/pay',
    'middleware' => 'api',
    'namespace' => 'Api\Pay'
], function() {
    //微信支付回调
    Route::post('wxpay_notify', 'WxpayNotifyController@notify');
    //支付宝支付回调
    Route::post('alipay_notify', 'AlipayNotifyController@notify');
});

Route::group([
    'prefix' => 'payment',
    'middleware' => 'api',
    'namespace' => 'Api\Payment'
], function() {
    //获取配置
    Route::get('config', 'ConfigController@config');
});

include_once("api_backend.php");